{% extends "shorturl/frame.html" %}
{% load string %}
{% load i18n %} 

{% block content %}

<div id="short_url">
<form action="{% url ytcommunity.shorturl.view.url.add %}" method="POST">
    <div class="short_url">
        <label for="id_url">{% trans "type your URL(starts with http:// or https://) here, and then click Submit" %}:</label><br>
        {{ form.url }}
        <input type="submit" value="{% trans 'Submit' %}" />
        {{ form.url.errors }}
    </div>
</form>

{% if post %}
<div id="short_url_show">

{% trans "the generated URL is" %}:

<div id="short_url_gen">
{{host_url}}{% url ytcommunity.shorturl.view.url.redirect id_or_name=post.key.id_or_name %}
</div>

<a href="{{host_url}}{% url ytcommunity.shorturl.view.url.redirect id_or_name=post.key.id_or_name %}">
{% trans "Open" %}
</a>

</div>
{% endif %}

</div>
  
{% endblock %}
